﻿#pragma execution_character_set("utf-8")

#ifndef __BASEKIT__
#define __BASEKIT__

#include "RootWindow.h"

extern string authorization;
extern unsigned int userId;
extern string nickName;
extern CAColor4B themeColor;
extern char baseUrl[];
extern CAFont font;
extern float mt;
typedef std::function<void(const string&)> StringCallback;
void sendHttp(CAView* view, const char* url, const std::string& parameters, const StringCallback& callback, const CAHttpRequest::Type httpType=CAHttpRequest::Type::Get, const bool json=false, const bool createAnimation=true);
CANavigationController* getRootWindow();
CAView* getSubview();
CALabel* getLabel(const string& text);
CATextField* getTextField();
void getAlert(CAView* view, const string& message);
CAPickerView* getPicker(CAView* view);
CADatePickerView* getDatePicker(CAView* view, const CADatePickerView::Mode mode=CADatePickerView::Mode::Date);
CAWebView* getWebClient(int threadId, float top, const float height=300);
/**
 * 获取UTF-8有符号字符的长度
 */
#define size4utf8(str)  StringUtils::getCharacterCountInUTF8String(str)
/**
* 格式化字符串
*/
#define obj2str(format, ...)  crossapp_format_string(format, __VA_ARGS__)

#endif